#include "GRWLock.h"
#include "GThread.h"
#include "GConditionVar.h"
#include "GError.h"

namespace GThread
{

	GRWLock::GRWLock()
	{
		Lock = NULL;
	}

	GRWLock::~GRWLock()
	{
		Release();
	}

	bool GRWLock::IsCreated() const
	{
		return Lock != NULL;
	}

	void GRWLock::Release()
	{
		// @NOTE: Does not have an o.s. release routine
		
		if (!IsCreated())
		{
			return;
		}

		delete Lock;
		Lock = NULL;

		CheckLockFreeCount();
	}

}